void solve()
{
  int n, m, q;
  cin >> n >> m >> q;

  vvi g(n + 1);
  DSU dsu(n);
  rep(i, 1, m) {
    int u, v;
    cin >> u >> v;
    g[u].pb(v), g[v].pb(u);
    dsu.merge(u, v);
  }

  vi dp(n + 1), vis(n + 1), vec;
  int len = 0;
  auto dfs = [&](auto dfs, int u, int fa) -> void {
    vec.pb(u);
    vis[u] = true;
    for (auto &v : g[u]) {
      if (v != fa) {
        dfs(dfs, v, u);
        len = max(len, dp[u] + dp[v] + 1);
        dp[u] = max(dp[u], dp[v] + 1);
      }
    }
  };

  rep(i, 1, n) {
    int j = dsu.find(i);
    if (!vis[j]) {
      len = 0;
      vec.clear();
      dfs(dfs, j, 0);
      for (auto &v : vec) {
        len = max(len, dp[v]);
      }
      dp[j] = len;
    }
  }

  while (q--) {
    int op, u, v;
    cin >> op;
    if (op == 1) {
      cin >> u;
      cout << dp[dsu.find(u)] << '\n';
    } else {
      cin >> u >> v;
      u = dsu.find(u), v = dsu.find(v);
      if (u == v) {
        continue;
      }
      dsu.merge(u, v);
      dp[u] = dp[v] = max({dp[u], dp[v], (dp[u] + 1) / 2 + (dp[v] + 1) / 2 + 1});
    }
  }
}